﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Ecopsy.DataTier;
using AgencyEntityLib.Context;
using Ecopsy.Tools;
using SqlLibrary;
using Ecopsy.DataTier.SqlLibrary;


namespace AgencyEntityLib.BaseEntity
{

    /// <summary>
    /// Состояние контракта    
    /// </summary>
    public class ContractStatus : EntitySingle
    {
        
        
        protected override string TagName
        {
            get
            {
                return "Status";
            }
        }

        public virtual string StatusName
        {
            get
            {
                wsDictionary ws = (wsDictionary)AgencyLib_GlobalConstants.CurrentAgency.WS_FactoryList[WS_FactoryList.wsKey_Dictionary];
                List<DictionaryItem> l=  ws.GetDictionary(AgencyLib_GlobalConstants.Contract_ContractType);

                foreach (DictionaryItem i in l)
                {
                    if (i.ID == ID)
                        return i.Value.ToString();
                }               
                return string.Empty;
            }
        }

        
    }


    /// <summary>
    /// статус - резерв (бронироввать до послед. дня тек. месяца.)
    /// </summary>
    public class ContractStatus_Reserv : ContractStatus
    {
        public override string ID
        {
            get
            {
                return AgencyLib_GlobalConstants.Contract_Reserv;
            }
            set
            {
                base.ID = value;
            }
        }
        public ContractStatus_Reserv()
        {
            
        }
        private DateTime _dtFinishReserv = DateTimeTools.GetLastDayInMonth(DateTime.Now);

        public DateTime dtFinishReserv
        {
            get { return _dtFinishReserv; }
            set { _dtFinishReserv = value; }



        }
    }

    /// <summary>
    /// статус - соц. реклама самореклама
    /// </summary>
    public class ContractStatus_Advice : ContractStatus
    {
        public override string ID
        {
            get
            {
                return AgencyLib_GlobalConstants.Contract_Advice; ;
            }
            set
            {
                base.ID = value;
            }
        }
        public ContractStatus_Advice()
        {
            
        }     
    }
    
    /// <summary>
    /// Контракт
    /// </summary>
    public class ContractStatus_Contract : ContractStatus
    {
        public override string ID
        {
            get
            {
               return AgencyLib_GlobalConstants.Contract_Contract;
            }
            set
            {
                base.ID = value;
            }
        }
        public ContractStatus_Contract()
        {
            
        }

        private Payments _Payments = new Payments();
       
        /// <summary>
        /// План платежей
        /// </summary>
        public Payments Payments { get { return _Payments; } set { _Payments = value; } }
        
        private PaymentsPlan _PaymentsPlan = new PaymentsPlan();
    
        /// <summary>
        /// График платежей
        /// </summary>
        public PaymentsPlan PaymentsPlan { get { return _PaymentsPlan; } set { _PaymentsPlan = value; } }


    }
    

    /// <summary>
    /// Корзина с оттобранными сторонами
    /// </summary>
    public class ContractStatus_Trash : ContractStatus
    {
        public override string ID
        {
            get
            {
                return AgencyLib_GlobalConstants.Contract_Trash;
            }
            set
            {
                base.ID = value;
            }
        }
        public ContractStatus_Trash()
        {
         
        }
    }
}
